StringKeyDictionary<TValue>
StringKeyDictionary<TValue>
StringKeyDictionary represents a dictionary collection of models. Unlike RealtimeDictionary, StringKeyDictionary is transactional. This means that models are not added to the collection until they are confirmed by the server. If any key has been modified before your change reaches the server, it will be rejected. It is up to your application to decide whether to retry the operation. Adding or removing items sends the minimal amount of information to the server in order to perform the update on all clients. The whole collection is not sent every time. Once a key has been added, it is assigned a unique ID by the server to reduce bandwidth for future updates.
Events
event DidInsertModelForKey<TValue> didInsertModelForKey
An event that fires when a model is successfully added to the collection by any client.
event DidRemoveModelForKey<TValue> didRemoveModelForKey
An event that fires when a model is successfully removed from the collection by any client.
event DidClearAllModels<TValue> didClearAllModels
An event that fires when the collection is cleared by any client.
Properties
TValue Item { get; }
Retrieve a model given a specific key.
int Count { get; }
The number of models currently stored in the collection.
Methods
void Insert(string key, TValue value, Action<bool> completionHandler)
Insert a model into the collection. The model will not be inserted until the server confirms the transaction.
void Remove(string key, Action<bool> completionHandler)
Remove a model from the collection. The model will not be removed until the server confirms the transaction.
void Clear(Action<bool> completionHandler)
Clear all models from the collection. Models will not be removed until the server confirms the transaction.
This operation will be rejected if any keys have been modified before the clear operation reaches the server.
bool TryGetValue(string key, TValue& value)
Attempt to retrieve a value from the collection.
This method will not throw an exception if the key is not found.
A boolean indicating whether the key was found within the collection.
bool ContainsKey(string key)
Check if a key exists within the collection.
A boolean indicating whether the key was found within the collection.
bool ContainsValue(TValue value)
Check if a model instance is contained in the collection.
This method has equivalent performance to Dictionary<T, V>.ContainsValue().
A boolean indicating whether the value was found within the collection.
IEnumerator<KeyValuePair<string, TValue>> GetEnumerator()
uint GetCollectionTypeID()